package cn.itcast.clients;

import cn.itcast.config.FeignClientConfiguration;
import cn.itcast.fallback.OrdersClientFallBackFactory;
import cn.itcast.entity.Order;
import cn.itcast.entity.Result;
import cn.itcast.entity.Room;
import cn.itcast.VO.OrderDayVO;
import cn.itcast.VO.OrderUserVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;


@FeignClient(value = "order-service",
        configuration = FeignClientConfiguration.class
        , fallbackFactory = OrdersClientFallBackFactory.class
)
public interface OrderClients {
    @GetMapping("/{userId}")
    Result<OrderDayVO> getOrderDay(@PathVariable("userId") Long roomId);

    @GetMapping("/userId/{id}")
    Result<OrderUserVO> getOrderDayByDate(@PathVariable Long userId);

    @PostMapping("/order/room")
    Result<Order> getOrderById(@RequestBody Room room);
}
